import urllib2, urllib
import json
from config import config

class CityApi():

    def __init__(self):
        self.target_city_url = config['params']['city_api'] + 'target_city'
        self.city_url = config['params']['city_api'] + 'cn_city'
        pass
    def getTargetCity(self):
        result = urllib2.urlopen(self.target_city_url).read()
        data = json.loads(result)
        return data
    def getCity(self):
        result = urllib2.urlopen(self.city_url).read()
        data = json.loads(result)
        return data